function PLOT_binmean(dat, cohs, abts, ax)% function fig_ = PLOT_binmean(dat, cohs)%% dat is nx3, where columns are% coh abt data% colorsco = {'c' 'm' 'r' 'g' 'b'};% set up figureif nargin < 4  fig = figure;  set(fig, 'Color', 'white', 'name', 'Running mean fig');  wysifig(fig);  ax = axes;  jigax(gca, 14);else  axes(ax);endhold on;  % coherence binsif nargin < 2 | isempty(cohs)  cohs = unique(dat(:,1));end% abort binsif nargin < 3 | isempty(abts)  abts = 100*round(dat(:,2)/100);endbinned_abts = nearest(dat(:,2), abts);abt_bins    = unique(binned_abts);means = nans(length(abt_bins), 1);for i = 1:length(cohs)  for j = 1:length(abt_bins)         Ls = dat(:,1)==cohs(i) & binned_abts==abt_bins(j);          means(j) = nanmean(dat(Ls,3));  end  plot(abt_bins, means, '-', 'Color', co{i}, 'LineWidth', 1);endxlabel('Abort time (ms)');ylabel('Latency (ms)');